/*
 * @Description: 
 * @Author: liangrongjun
 * @Date: 2021-09-26 10:26:27
 * @LastEditors: liangrongjun
 * @LastEditTime: 2021-09-26 10:29:53
 */
import React, { lazy, Suspense } from 'react';
import { Route, Switch } from 'react-router-dom';
import ErrorBoundary, { PageError } from '@/components/error-boundary';
// import { ErrorBoundary } from 'react-error-boundary'


const asyncImport = (name: string) => {
  return lazy(() => import('../app/' + name));
};

export default () => {
  return (
    <ErrorBoundary>
      <Suspense fallback={<></>}>
        <Routes />
      </Suspense>
    </ErrorBoundary>
  );
};


export const Routes = () => {
  return (
    <Switch>
      <Route
        exact
        path='/test1'
        component={asyncImport('test1')}
      />

      <Route component={PageError} />
    </Switch>

  );
};

